package com.li.admin.config;

import com.li.admin.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class AdminWebConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor())
                .addPathPatterns("/**")//所有的请求都被拦截，包括静态资源
                .excludePathPatterns("/", "/login","/css/**", "/fonts/**", "/images/**", "/js/**");

        WebMvcConfigurer.super.addInterceptors(registry);
    }
}
